﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Web;

namespace TbShop.Web.Helpers
{
    public class TxtHelper
    {
        public static string Read(string fileName)
        {
            FileStream fs = new FileStream(fileName, FileMode.Open);
            StreamReader sr = new StreamReader(fs, Encoding.Default);
            var result = sr.ReadToEnd().Replace("\r\n", "").Replace(" ", "");
            sr.Close();
            fs.Close();
            return result;
        }

        public static void Write(string str)
        {
            FileStream fs = new FileStream("C:\\log.txt", FileMode.Append);
            StreamWriter sw = new StreamWriter(fs, Encoding.Default);
            sw.Write(str + "\r\n");
            sw.Close();
            fs.Close();
        }
    }
}